home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 013 / td3.arc / MANUAL.TD3 next >
Encoding:
Text File  |  1986-05-04  |  19.5 KB  |  593 lines

  1. .he               (Copyright 1985 Mark Johnson)         Page #
  2.                             TurboDraw
  3.                            User Manual
  4.  
  5. TurboDraw  has  been  designed to simplify the  task  of  writing 
  6. report  and screen layouts for the Pascal  programmer.   This  is 
  7. done  by  interpreting  an  input  screen  generated  by  a  word 
  8. processor or editor into Pascal data and code statements that can 
  9. be  included  into the users program.   For simple tasks such  as 
  10. file inquiry or screen entry,  little extra code need be  written 
  11. by the user to produce a clear, error free program.
  12.  
  13.                        System Requirements
  14.  
  15. TurboDraw  is  designed to run on any IBM PC or  true  compatible 
  16. system.  The program will support either an IBM color card, or an 
  17. IBM  monochrome  card.   Of  course Turbo Pascal is  required  to 
  18. compile the output of this program.  To compile TurboDraw itself, 
  19. you must have at least version 2.00 of Turbo Pascal. 
  20.  
  21.                          ACKNOWLEGMENTS
  22.  
  23. TurboDraw  was written by Mark Johnson of MicroTools  Co.   There 
  24. are several routines worthy of mention that I borrowed from other 
  25. public domain software.  Thanks go to:
  26.  
  27. Kurt M.  Gutzmann - For the pull-down menu routines.   One of the 
  28. most  flexible  and well designed 'window' tools I've ever  seen.  
  29. It will be well worth the time for any programmer using Turbo  to 
  30. study, and use these routines.
  31.  
  32. John Friel and the Forbin Project - For clean, easy to use Window 
  33. Routines.   One look at QMODEM 2.0,  and you can tell that  these 
  34. guys know how to program.
  35.  
  36. Although  this  program is written specifically for the  IBM  PC, 
  37. there are versions to run under MS-DOS,  CP/M,  CP/M-86,  and NCR 
  38. ITX Pascal.  Other versions for other languages include:
  39.  
  40. CDRAW           For Unix C
  41. CODRAW          For MicroSoft and Ryan-Mcfarland COBOL
  42. PLIDRAW         For PL/I subset G
  43. BASDRAW         For (Ugh) basic
  44. NCRDRAW         For NCR NEAT/3
  45.  
  46. The above programs are available for a small fee.
  47.  
  48.  
  49.             Mark Johnson
  50.             2272-F Benson Avenue
  51.             St. Paul, MN 55116
  52.             (612)-698-3686
  53. .pa
  54.                        FILES ON THIS DISK
  55.  
  56. TD3.PAS    - Source code for TurboDraw, in Turbo Pascal
  57. TEST.SCR   - Sample SCREEN input file
  58. MANUAL.TD3 - This manual.
  59. TD.LIB     - Library file for TurboDraw programs
  60.  
  61.  
  62.  
  63.                    Preparing input for TurboDraw
  64.  
  65. This  section will show you how to prepare the required input for 
  66. TurboDraw.   We  will  use a program exercise that  accesses  an 
  67. indexed  inventory file for screen inquiry.   The format  of  the 
  68. screen  is  shown in Figure 2.1.   The bottom line of the  screen 
  69. requests an item number from the operator,  which will be used as 
  70. a key to access the detail record from an indexed file.  Once the 
  71. record is accessed,  the required information is displayed on the 
  72. CRT.  After the information is presented on the CRT,  the program 
  73. will loop back to the beginning,  allowing the operator to  enter 
  74. another item number.
  75.  
  76. (figure 2.1 DEMO.OUT)
  77.  
  78.                       INVENTORY INQUIRY
  79.  
  80.  
  81.      ITEM DESCRIPTION                       ORDERING
  82.  
  83.      Item number  188144             On Order     4200
  84.      Item Name    Murphy's Catsup    Case Cost     29.50
  85.           Size    16Oz                    List     49.95
  86.           Class   05
  87.  
  88.  
  89.      WAREHOUSE INFO                         HISTORY
  90.                                            Cases        Bots
  91.  
  92.      Quan Cases  2314              MTD         765         24  
  93.      Bottles       10              YTD        4341        546  
  94.  
  95.  Case Location  123-08 
  96.  Bottles        910-08 
  97.  
  98.  
  99.  
  100.  
  101. Enter Item Number ( 0 to end ):  188144
  102. .pa
  103.  
  104.                  Creating the SCREEN INPUT FILE
  105.  
  106. The  SCREEN input file is a 'picture' of what you want  displayed 
  107. on the crt screen.  The SCREEN file consists of up to 24 lines of 
  108. 80  characters.   Each  line is composed of one or more  LITERALS 
  109. and/or  VARIABLES.   Each variable is preceded by an  exclamation 
  110. mark  (!) or a crosshatch (#).   The exclamation  mark  indicates 
  111. that  its  associated  variable is an output  variable,  and  the 
  112. crosshatch indicates an input variable.   Variables may be up  to 
  113. 64 characters long, with no embedded spaces.  Shown in figure 2.2 
  114. is  the SCREEN file ready for use by TurboDraw.   It was prepared 
  115. with Wordstar ( A popular word processor). 
  116.  
  117.  
  118. (figure 2.2 DEMO.SCR)
  119.  
  120.                       INVENTORY INQUIRY
  121.  
  122.  
  123.      ITEM DESCRIPTION                       ORDERING
  124.  
  125.      Item number  !item              On Order   !ionorder
  126.      Item Name    !iname             Case Cost  !icost
  127.           Size    !isize                  List  !ilist
  128.           Class   !iclass
  129.  
  130.  
  131.      WAREHOUSE INFO                         HISTORY
  132.                                            Cases        Bots
  133.  
  134.      Quan Cases !icases            MTD     !imtdcs      !imtdbt
  135.      Bottles    !ibottles          YTD     !iytdcs      !iytdbt
  136.  
  137.  Case Location  !icsloc
  138.  Bottles        !ibtloc
  139.  
  140.  
  141.  
  142.  
  143. Enter Item Number ( 0 to end ):  #item
  144. .pa
  145.                          Running TurboDraw
  146.  
  147. When executed,  TurboDraw shows the SETUP MENU,  which allows the 
  148. user to specify several options and input/output file names.  
  149.  
  150. The  menu is a 'Pull-down' menu based on those designed by Xerox, 
  151. and  later claimed as proprietary by Apple Computer.   To  select 
  152. options,  simply move the cursor sideways to a major option, then 
  153. vertically to select the minor option.
  154.  
  155. Shown below in figure 3.1 is the SETUP MENU.   Refer to this menu 
  156. as we discuss the following section.
  157.  
  158. (Figure 3.1)
  159. CONTINUE      INPUT          OUTPUT         LIBRARY
  160. ------------------------------------------------------------------------
  161. next menu     screen file    pascal file    library file
  162.  
  163.  
  164.  
  165.  
  166.  
  167.                   Screen file name           DEMO.SCR
  168.                   Generated program name     DEMO.PAS
  169.                   Library File Name          TD.LIB
  170.  
  171.  
  172.  
  173.  
  174.  
  175. (end of figure 3.1)
  176.  
  177.  
  178.                            SETUP MENU
  179.  
  180.                         Run time options
  181.  
  182. SCREEN FILE NAME - This defines the name of the file that you 
  183. created  that contains the screen definitions.
  184.  
  185. GENERATED  PROGRAM NAME - The name of the  generated  pascal 
  186. program that will be created by TurboDraw.
  187.  
  188. LIBRARY  FILE  NAME  - This file will  be  included  in  the 
  189. beginning of the generated Pascal program.
  190.  
  191. CONTINUE  - Select  this option after you  have  selected  the 
  192. screen file name and the pascal output file name.  TurboDraw will 
  193. open  the  files and proceed to the MAIN MENU if the  files  have 
  194. been opened successfully,  otherwise it will let you re-enter the 
  195. offending file name.
  196. .pa
  197. (figure 3.2 MAIN MENU)
  198.  
  199. COMMANDS      OPTIONS
  200. ------------------------------------------------------------------------
  201. setup menu    library?
  202. sort defs     procedure?
  203. generate      variables?
  204.  
  205.  
  206.                             MAIN MENU
  207.  
  208.  
  209.  
  210.                     Include Library Functions    No
  211.                     Generate a Procedure         Yes (test_print) 
  212.                     Include VAR Definitions      Yes
  213.  
  214.  
  215.  
  216. (end of figure 3.2)
  217.  
  218.  
  219.         The following options are valid for the MAIN MENU
  220.  
  221.                              OPTIONS
  222.  
  223. LIBRARY? - Selecting this option will toggle a yes/no switch.  If 
  224. you select YES,  then a library of I/O functions will be included 
  225. in  the  generated  program.   These functions are  used  by  the 
  226. generated Pascal program for input of integer and real numbers.
  227.  
  228. PROCEDURE?  - Selecting this option will toggle a yes/no  switch.  
  229. If  you  select  YES,  then  the generated Pascal  code  will  be 
  230. formatted as a procedure,   otherwise the output will be designed 
  231. to  be inline code that will become PART of a procedure  or  main 
  232. program that you write.
  233.  
  234. VARIABLES?  - Selecting  this option will toggle a yes/no switch.  
  235. If  you select YES,  then TurboDraw will create declarations  for 
  236. the variables used in the output code.
  237.  
  238. .pa
  239.  
  240.                             COMMANDS
  241. SETUP MENU - Before TurboDraw can generate the Pascal program, it 
  242. needs  some information about the variables in the  screen  file.  
  243. TurboDraw  needs to know the length and number of decimal  places 
  244. of   each  variable.    See  the  Section  SETUP  MENU  for  more 
  245. information on setting up variables.
  246.  
  247.  
  248. SORT DEFS - This  feature allows you to change the order in which 
  249. items  are  displayed  on the screen.  See  the  Section  SORTING 
  250. DEFININITIONS for more information.
  251.  
  252.  
  253. GENERATE  - When  the variable declarations are  done,  you  will 
  254. return to the main menu.   You can alter or examine the  variable 
  255. declarations by selecting option V again,  or generate the Pascal 
  256. program  by  selecting  this option.   The finished  output  from 
  257. TurboDraw is shown in figure 3.5.
  258.  
  259.  
  260. .pa
  261.                            SETUP MENU
  262.  
  263. This  menu is the heart of the entire TurboDraw system.  In  this 
  264. menu,  you define the length, type, and color of each variable on 
  265. the  screen.   Refer to figure 3.4 as we discuss the features  of 
  266. the setup menu.
  267.  
  268. Below  the menu bar is an image of the screen output as TurboDraw 
  269. sees  it.    Numeric  variables  are  displayed  as  Nines,   and 
  270. Alphanumeric variables are displayed as X's.  Using the menu, you 
  271. can step through the variables and change their  attributes,  and 
  272. as you do, the screen will change to reflect your changes.  Let's 
  273. go through the options one by one:
  274.  
  275.   FILE OPERATIONS
  276.  
  277. Next  Item   - Selecting  this will cause the next field  on  the 
  278. screen to begin flashing. At this point, any changes will be made 
  279. to the flashing field.
  280.  
  281. Main  Menu  - Selecting this option will return you to  the  main 
  282. menu.
  283.  
  284.   TYPE OPERATIONS
  285.  
  286. Alpha  - Selecting this option will cause the blinking  field  to 
  287. show   as  X's,   and  indicates  to  TurboDraw  that  it  is  an 
  288. ALPHANUMERIC field.
  289.  
  290. Numeric - Selecting this option will cause the blinking field  to 
  291. show as 9's, and indicates a NUMERIC field.
  292. .pa
  293.   SIZE OPERATIONS
  294.  
  295. Length - Valid for alpha and numeric fields.   The length of each 
  296. field  is specified initially by the number of characters in  the 
  297. fields'  name.   You  can change it to any value greater than  or 
  298. equal to zero.   For numeric fields, you may also want to specify 
  299. the SCALE of the field (see below).
  300.  
  301. Scale  - The  scale of a numeric field is the  number  of  digits 
  302. beyond  the decimal point.   Thus,  the maximum value that can be 
  303. held in a variable of LENGTH 7 and SCALE 2 is 99999.99,   And  in 
  304. Pascal,   it   would  be  displayed  with  a  WRITE(variable:7:2) 
  305. statement.
  306.  
  307.                              EXAMPLE
  308.  
  309. Using  the  SETUP  menu,  change  the 'item  name'  field  to  an 
  310. alphanumeric field of length 15.
  311.  
  312. STEP  1.   Select  'next item' from the menu  bar  twice  by 
  313. pressing  the return key until the 'item name' field  is 
  314. flashing.
  315.  
  316. STEP  2.    Press the right arrow key to move the bar  to  the 
  317. 'TYPE' bar in the menu.  Press the return key to select 'alpha'
  318.  
  319. STEP 3.  Press the right arrow twice to the 'SIZE' bar, and press 
  320. return  to select 'LENGTH'.   You will be prompted for the length 
  321. of the field.  Enter 15.
  322.  
  323. STEP 4.  If you want to change the color of the field, select the 
  324. 'COLOR' bar and press return.   Now another menu,  the COLOR MENU 
  325. will  be shown,   Move the bar around until you see a  color  you 
  326. like,  and  press return to select that color.   To return to the 
  327. SETUP menu, select the 'last menu' option.
  328.  
  329. (NOTE  - If you have a monochrome card in your PC,  then most  of 
  330. the  colors  will  show as  white,  or  underlined,  or  blinking 
  331. characters, or combinations.)
  332.  
  333. .pa
  334. (figure 3.4)
  335.  
  336. FILE          TYPE           SIZE           COLOR
  337. ------------------------------------------------------------------------
  338. next item     alpha          length         next menu
  339. main menu     numeric        scale
  340.  
  341.  
  342.                       INVENTORY INQUIRY
  343.  
  344.  
  345.      ITEM DESCRIPTION                       ORDERING
  346.  
  347.      Item number  999999             On Order   999999
  348.      Item Name    9999               Case Cost  999999
  349.           Size    9999                    List  999999
  350.           Class   999999
  351.  
  352.  
  353.      WAREHOUSE INFO                         HISTORY
  354.                                            Cases        Bots
  355.  
  356.      Quan Cases  999999            MTD      999999     999999  
  357.      Bottles     999999            YTD      999999     999999  
  358.  
  359.  Case Location  99999 
  360.  Bottles        99999  
  361.  
  362.  
  363. Enter Item Number ( 0 to end ):  9999
  364. .pa
  365.  
  366.                        SORTING DEFINITIONS
  367.  
  368. SORT - This  feature allows you to change the order in which 
  369. items are displayed on the screen.   For example you may want  an 
  370. input  field  on the bottom of the screen to be completed  before 
  371. displaying another field near the top of the screen.
  372.  
  373. When  you  select this option,  you will be shown a list  of  all 
  374. literals  and  variables that have been  accepted  by  TurboDraw.  
  375. Each  entry  will  have  a line number  associated  with  it,  in 
  376. increments of 10.   TurboDraw will ask you for the line number of 
  377. the  item you wish to move,  and the destination line number  you 
  378. wish  to  move it to.    Don't enter an existing number  for  the 
  379. destination,  or  you will lose the field that was referenced  by 
  380. that  number.   When  you are done moving items,  enter '999'  to 
  381. return to the main menu.
  382. .pa
  383. (figure 3.5 DEMO.PAS )        { My comments are in UPPER CASE }
  384.  
  385. { Start of Turbodraw code }
  386. Var
  387.  
  388. { THE FOLLOWING VARIABLE DECLARATIONS ARE INCLUDED BY SETTING THE 
  389. 'variables?' FLAG TO Yes. } 
  390.  
  391.   item : Integer;
  392.   ionorder : Real;
  393.   iname : String[0];
  394.   icost : Real;
  395.   isize : String[0];
  396.   ilist : Real;
  397.   iclass : Integer;
  398.   icases : Integer;
  399.   imtdcs : Real;
  400.   imtdbt : Real;
  401.   ibottles : Integer;
  402.   iytdcs : Real;
  403.   iytdbt : Real;
  404.   icsloc : String[4];
  405.   ibtloc : String[4];
  406.   item : Integer;        { THIS IS A DUPLICATION, THE PROGRAMMER MUST }
  407.                          { DELETE IT BEFORE COMPILING  }
  408.  
  409.  
  410. Procedure prt_scrn;      { PROCEDURE SELECTED AT MAIN MENU }
  411. Begin
  412.   Clrscr;
  413.   TextColor(15);
  414.   Gotoxy(23,1);
  415.   TextColor(15);
  416.   Write('INVENTORY INQUIRY');
  417.   Gotoxy(6,4);
  418.   Write('ITEM DESCRIPTION                       ORDERING');
  419.   Gotoxy(6,6);
  420.   Write('Item number  ');
  421.   Gotoxy(19,6);
  422.   TextColor(7);
  423.   Write(item:6);
  424.   Gotoxy(38,6);
  425.   TextColor(15);
  426.   Write('On Order   ');
  427.   Gotoxy(49,6);
  428.   TextColor(7);
  429.   Write(ionorder:7:2);
  430.   Gotoxy(6,7);
  431.   TextColor(15);
  432.   Write('Item Name    ');
  433.   Gotoxy(19,7);
  434.   TextColor(7);
  435.   Write(iname);
  436.   Gotoxy(38,7);
  437.   TextColor(15);
  438.   Write('Case Cost  ');
  439.   Gotoxy(49,7);
  440.   TextColor(7);
  441.   Write(icost:5:2);
  442.   Gotoxy(11,8);
  443.   TextColor(15);
  444.   Write('Size    ');
  445.   Gotoxy(19,8);
  446.   TextColor(7);
  447.   Write(isize);
  448.   Gotoxy(43,8);
  449.   TextColor(15);
  450.   Write('List  ');
  451.   Gotoxy(49,8);
  452.   TextColor(7);
  453.   Write(ilist:5:2);
  454.   Gotoxy(11,9);
  455.   TextColor(15);
  456.   Write('Class   ');
  457.   Gotoxy(19,9);
  458.   TextColor(7);
  459.   Write(iclass:2);
  460.   Gotoxy(6,12);
  461.   TextColor(15);
  462.   Write('WAREHOUSE INFO                         HISTORY');
  463.   Gotoxy(44,13);
  464.   Write('Cases        Bots');
  465.   Gotoxy(6,15);
  466.   Write('Quan Cases ');
  467.   Gotoxy(17,15);
  468.   TextColor(7);
  469.   Write(icases:6);
  470.   Gotoxy(36,15);
  471.   TextColor(15);
  472.   Write('MTD     ');
  473.   Gotoxy(44,15);
  474.   TextColor(7);
  475.   Write(imtdcs:7:2);
  476.   Gotoxy(57,15);
  477.   Write(imtdbt:7:2);
  478.   Gotoxy(6,16);
  479.   TextColor(15);
  480.   Write('Bottles    ');
  481.   Gotoxy(17,16);
  482.   TextColor(7);
  483.   Write(ibottles:6);
  484.   Gotoxy(36,16);
  485.   TextColor(15);
  486.   Write('YTD     ');
  487.   Gotoxy(44,16);
  488.   TextColor(7);
  489.   Write(iytdcs:7:2);
  490.   Gotoxy(57,16);
  491.   Write(iytdbt:7:2);
  492.   Gotoxy(2,18);
  493.   TextColor(15);
  494.   Write('Case Location  ');
  495.   Gotoxy(17,18);
  496.   TextColor(7);
  497.   Write(icsloc);
  498.   Gotoxy(2,19);
  499.   TextColor(15);
  500.   Write('Bottles        ');
  501.   Gotoxy(17,19);
  502.   TextColor(7);
  503.   Write(ibtloc);
  504.   Gotoxy(1,24);
  505.   TextColor(15);
  506.   Write('Enter Item Number ( 0 to end ):  ');
  507.   Gotoxy(34,24);
  508.   TextColor(5);
  509.   item:=Getint(6);
  510.   TextColor(15);
  511. End;
  512. { End of Turbodraw Code }
  513.  
  514.  
  515. .pa
  516.                        USING TurboDraw OUTPUT
  517.  
  518.                        Things to watch for
  519.  
  520. 1)  Duplicate  variables  - If you have two fields  on  the  same 
  521. screen with the same name, and you've selected the 'include VARS' 
  522. option, then two separate declarations for the same variable will 
  523. be included in the program.  Delete one of them.
  524.  
  525. 2) The total number of fields on one screen cannot exceed 80.
  526.  
  527. 3) When using the SORT feature,  try not to overwrite a field  by 
  528. assigning  a line number that is already in  use.   Unpredictable 
  529. output will result.
  530.  
  531. 4) In the setup menu,  you can only go forward, not backward.  If 
  532. you  want  to go back to change a definition,  select  the  'main 
  533. menu' function,  then reselect the 'Setup' option,  and step down 
  534. to the field in question.
  535.  
  536.  
  537. .pa
  538.                        Technical overview
  539.  
  540.      Work  on  TurboDraw  began in 1983  with  a  program  called 
  541. PLIDRAW  which generates screens for the PL/I language.   in 1984 
  542. several  other languages were included such as NCR  Neat/3,  8086 
  543. assembler,  and  Pascal.   In  early 1985 the  first  version  of 
  544. TurboDraw  was released.   It was written in PL/I and designed to 
  545. run  on any machine capable of running PL/I Subset G.   In  1985, 
  546. TurboDraw  and CODRAW (for NCR COBOL ) were translated from  PL/I 
  547. to  Pascal  primarily because of the portability  of  the  Pascal 
  548. language.  Finally, in 1986 a version specifically for the IBM PC 
  549. has been developed,   This version supports full color,  windows, 
  550. sound, etc.  Future versions will be available to run directly on 
  551. mainframes supporting standard Pascal.
  552.  
  553.  
  554.                           How It Works
  555.  
  556.                         SCREEN GENERATOR
  557.  
  558.      Once  all options and files have been set up from the  setup 
  559. menu,  the  SCREEN file is read in line by line.   Each  line  is 
  560. broken  up  into  individual  components:   either  variables  or 
  561. literals.   A  literal  is  a  character string  from  1  to  132 
  562. characters  long  delimited  by blanks or  a  newline  character.  
  563. Embeded  spaces  are allowed.   A Variable is a character  string 
  564. from  1 to 64 characters long preceded by either  an  exclamation 
  565. mark,  (which  indicates  an output variable),  or  a  crosshatch 
  566. (which indicates an input variable).  Each variable or literal is 
  567. stored in a table containing such information as its' type, X and 
  568. Y  coordinates,  length,  scale,  and  several  other  relevant 
  569. factors.   Once  the  entire file has been read,  the  MAIN  MENU 
  570. prompts  the  operator  to enter variable  declarations.   It  is 
  571. necessary for the operater to enter variable declarations manually 
  572. because this information is not contained in the SCREEN file.
  573.  
  574. When   all   variables  have  been  declared  to  the   operators 
  575. satisfaction,  selecting  the 'GENERATE' option starts  the  code 
  576. generation phase.
  577.  
  578.                          CODE GENERATOR
  579.  
  580. If  you  selected the 'include variables' option,  the  generator 
  581. first outputs the variables to the .PAS file.
  582.  
  583. If  you  selected  the  'Include  .LIB  file'  option,  then  the 
  584. specified library file is copied to the .PAS file.   The  library 
  585. file,  TD.LIB,  contains  routines for integer and decimal  input 
  586. with full error checking.
  587.  
  588. Next, the  table that was created from the SCREEN file is examined 
  589. item by item, and the appropriate code is generated and output to 
  590. the  PAS file.   If you have selected a procedure name,  then the 
  591. code  will  be  output  as a  procedure,  otherwise  it  will  be 
  592. structured as in-line code.
  593.